package com.example.demo1.utils;

public class ThreadLocalUtil {
    //设置一个线程
    private static final ThreadLocal THREAD_LOCAL = new ThreadLocal();

    //从线程变量中获取数据
    public static <T> T get(){
        return  (T) THREAD_LOCAL.get();
    }

    //设置一个线程变量
    public static void set(Object value){
        THREAD_LOCAL.set(value);
    }

    //释放空间
    public static void remove(){
        THREAD_LOCAL.remove();
    }
}
